package net.interneteidee.converter;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;

import net.interneteidee.entity.Cliente;
import net.interneteidee.entity.Famiglia;

@ManagedBean
@SessionScoped
public class ClienteConverter extends GenericConverter {
	
	 	@Override
	    public Object getAsObject(FacesContext facescontext, UIComponent uicomponent, String value) {
	     
	 		if(value.equals("")) 
	    	  return null;
	 		else
	 			return value;
	     
	       
	    }

	    @Override
	    public String getAsString(FacesContext facescontext, UIComponent uicomponent, Object obj) {
	    	Cliente cliente = (Cliente) obj;
	    	return cliente.getDenominazione();
	    }
}
